﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >

<head>
    <title>后台登录</title>
   <script src="/lib/jquery-1.3.2.min.js" type="text/javascript"></script> 
   <script type="text/javascript" src="/lib/common.js"></script>

   <script type="text/javascript">
       var FromUrl = getQueryStringByName("FromUrl");
       if (!FromUrl) {
           FromUrl = encodeURIComponent("AdminIndex.aspx");
       }
       $(function () {
           $("#login").resize(function () {
               location.reload();
           });

           $(".login-text").focus(function() {
               $(this).addClass("login-text-focus");
           }).blur(function() {
               $(this).removeClass("login-text-focus");
           });

           $(document).keydown(function(e) {
               if (e.keyCode == 13) {
                   dologin();
               }
           });



           $("#btnLogin").click(function() {
               dologin();
           });


           function dologin() {
               var username = $("#txtUsername").val().replace(/[ ]/g, "");
               var password = $("#txtPassword").val().replace(/[ ]/g, "");
               var validateCode = $("#txtValidateCode").val().replace(/[ ]/g, "");
               if (username == "") {
                   alert('账号不能为空!');
                   $("#txtUsername").focus();
                   return;
               }
               if (password == "") {
                   alert('密码不能为空!');
                   $("#txtPassword").focus();
                   return;
               }
               if (validateCode == "") {
                   alert('验证码不能为空!');
                   $("#txtValidateCode").focus();
                   return;
               }
               $.ajax({
                   type: 'post', cache: false, dataType: 'json',
                   url: '/handler/Validate.ashx',
                   data: [
                    { name: 'Action', value: 'adminLogin' },
                    { name: 'username', value: username },
                    { name: 'password', value: password },
                    { name: 'validateCode', value: validateCode }
                    ],
                   success: function(result) {
                       if (!result.IsSuccess) {
                           alert(result.Msg);
                           $("#txtUsername").focus();
                           return;
                       } else {
                           location.href = decodeURIComponent(FromUrl);
                       }
                   },
                   error: function() {
                       alert('发送系统错误,请与系统管理员联系!');
                   },
                   beforeSend: function() {
                       // $.ligerDialog.waitting("正在登陆中,请稍后...");
                       $("#btnLogin").attr("disabled", true);
                   },
                   complete: function() {
                       // $.ligerDialog.closeWaitting();
                       $("#btnLogin").attr("disabled", false);
                   }
               });
           }
       });
       
   </script>
   <style type="text/css" >
       html,body
       {
           width:100%;
           height:100%;
           padding:0;
           margin:0;
           font-size:12px;
           overflow: hidden; 
           position: relative;
       }
        #login{text-align:center;  background:url('/images/login_bg02.png') repeat-x center center;height:100%;position:relative;
           top: -1px;
           left: 1px;
       }
        #sublogin { position:absolute;  top:50%; left:50%;} 
        #content { position:relative; top:-50%;left:-50%; }
        #loginPanel{ 
            text-align:left; width:667px;height:372px; 
            margin:-171px auto; 
            padding:185px 0 0 0;
            background:url('/images/login_panel02.png') no-repeat ; 
            _background-image: none; /* IE6 */
            _filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/login_panel02.png'); /* IE6 */
                     
        }
        #loginPanel div input{ border-style:none;}
        #btnLogin{
            background:url('/images/login_button02.png') no-repeat;width:91px;height:39px;list-style-type:none;border:none; overflow:hidden; cursor:pointer;
            _background-image: none; /* IE6 */
            _filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/login_button02.png'); /* IE6 */
        }
        #txtUsername,#txtPassword{ width:242px;} 
        #txtValidateCode{width:65px;}
        #ValidateCodeImg{ background:url('/images/validate_code.jpg') no-repeat;width:67px;height:25px; display:inline-table;}
        
        .login-text{ left:20px; border:1px solid #7dafba; background:#f9f9f9;height:20px;}
   </style>

</head>
<body>
    <div id="login" >
        <div id="sublogin">
            <div id="content">
                <div id="loginPanel" >
                    <div style="position:absolute">
                        <div style="padding:6px 0 11px 155px;">
                            <!--<span>用户名：</span>-->
                            <input type="text" id="txtUsername" class="login-text"/>
                        </div>
                        <div style="padding:8px 0 11px 155px;">
                            <!--<span>密　码：</span>-->
                            <input type="password" id="txtPassword"  class="login-text"/>
                        </div>
                        <div style="padding:1px 0 11px 155px;">
                            <!--<span>验证码：</span>-->
                            <input type="text" id="txtValidateCode" class="login-text"/>
                            <img src="/CheckCode.aspx" style="margin-left:5px;" id="checkcode_img" name="checkcode" alt="请输入验证码!" />
                            <a title="刷新验证码" style=" color:#FFFFFF;" href="#" onclick="javascript:document.getElementById('checkcode_img').src='/CheckCode.aspx?id='+Math.random();return false;">看不清，换张图片？</a>
                        </div>
                        <div style="padding:7px 0 0 146px;">
                            <input  value = "" type="submit" id="btnLogin"  />
                        </div>
                    </div>
                    
                 </div>
            </div>  
        </div>
    </div>
    
</body>
</html>
